import 'package:flutter/material.dart';
import 'CountBLoC.dart';

class BLoCTwo extends StatelessWidget {
//  @override
//  _BLoCTwoState createState() => _BLoCTwoState();
//}
//
//class _BLoCTwoState extends State<BLoCTwo> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("BLoC测试子页"),
      ),
      floatingActionButton: FloatingActionButton(
        onPressed: () => bLoC.increment(),
        child: Icon(Icons.add),
        tooltip: "加加加",
      ),
      body: Center(
        child: StreamBuilder<int>(
          stream: bLoC.stream,
          initialData: bLoC.value,
          builder: (context, snapshot) => Text(
                snapshot.data.toString(),
                style: TextStyle(fontSize: 30, color: Colors.red[500]),
              ),
        ),
      ),
    );
  }
}
